Method and apparatus for real-time estimation and control of physiological parameters

ABSTRACT

A real-time glucose estimator uses a linearized Kalman filter to determine a best estimate of glucose level in real time. The real-time glucose estimator receives at least one measurement corresponding to glucose level. The measurement can be obtained with one or more sensors and is provided to the linearized Kalman filter in real time. The linearized Kalman filter has dynamic models and executes a recursive routine to determine the best estimate of glucose level based upon the measurement. Additional information can be provided to the linearized Kalman filter for initialization, configuration, and the like. Outputs of the linearized Kalman filter can be provided to a patient health monitor for display or for statistical testing to determine status of the real-time glucose estimator. The real-time glucose estimator can be implemented using a software algorithm. A real-time controller operating as an artificial pancreas uses a Kalman control algorithm to control glucose level of a patient in real time. The real-time controller receives an estimate of the patien: glucose level and a reference glucose level. The estimate of the patient glucose level can be provided by an optimal estimator implemented using a linearized Kalman filter. The estimated glucose level and the reference glucose level are processed by the Kalman control algorithm to determine a control command in real time. The Kalman control algorithm has a dynamic process forced by the control command a cost function determining a relative level of control. The control command is provided to a dispenser which secretes insulin or glucagon in response to the control command to correct a relatively high glucose level or a relatively low glucose level.

COPYRIGHT RIGHTS

[0001] A portion of the disclosure of this patent document contains material that is subject to copyright protection. The copyright owner has no objection to the facsimile reproduction by anyone of the patent document or of the patent disclosure as it appears in the Patent and Trademark Office patent files or records, but otherwise reserves all copyright rights whatsoever.

BACKGROUND OF THE INVENTION

[0002] 1. Field of the Invention

[0003] This present invention relates generally to a method and apparatus for estimating and controlling physiological parameters and more particularly to an optimal estimator and an optimal controller for estimating and controlling glucose levels in a patient.

[0004] 2. Description of the Related Art

[0005] Different types of sensors (e.g., optical sensors) are available for monitoring of physiological parameters (e.g., glucose concentration). Glucose monitoring is typically performed by people with diabetes mellitus which is a medical condition involving a body's inability to produce the quantity or quality of insulin needed to maintain a normal circulating blood glucose. Frequent monitoring of glucose is generally necessary to provide effective treatment and to prevent long term complications of diabetes (e.g., blindness, kidney failure, heart failure, etc.). New methods of monitoring glucose are fast, painless and convenient alternatives to the typical capillary blood glucose (CBG) measurements which involve finger pricks that are painful, inconvenient and difficult to perform for long term.

[0006] Optical measurement of glucose is performed by focusing a beam of light onto the body. Optical sensors determine glucose concentration by analyzing optical signal changes in wavelength, polarization or intensity of light. However, many factors other than glucose concentration also contribute to the optical signal changes. For example, sensor characteristics (e.g., aging), environmental variations (e.g., changes in temperature, humidity, skin hydration, pH, etc.), and physiological variations (e.g., changes in tissue fluid due to activity, diet, medication or hormone fluctuations) affect sensor measurements.

[0007] Various methods are used to improve the accuracy of the sensor measurements. One method (e.g., multivariate spectral analysis) utilizes calibration models developed by initially measuring known glucose concentrations to correct subsequent sensor measurements. The calibration models become inaccurate over time due to dynamic changes in physiological processes. Another method (e.g., adaptive noise canceling) utilizes signal processing to cancel portions of the sensor measurements unrelated to glucose concentration. For example, two substantially simultaneous sensor measurements at different wavelengths make up a composite signal which can be processed to cancel its unknown and erratic portions. However, many sensors do not provide substantially simultaneous measurements at two different wavelengths.

SUMMARY OF THE INVENTION

[0008] The present invention solves these and other problems by providing a method and apparatus for making optimal estimates of a physiological parameter (e.g., glucose level), assessing reliability of the optimal estimates, and/or providing optimal control of the physiological parameter in real time using one or more sensor measurements at each measurement time epoch (or interval). The sensor measurements can be time-based (e.g., every five minutes) to provide continuous monitoring and/or regulation of the physiological parameter. The sensor measurements are a function of the physiological parameter within specified uncertainties.

[0009] An optimal estimator provides an accurate estimate of glucose level in real time using a sensor with at least one output. In one embodiment, the optimal estimator is integrated with the sensor and an output display to be a compact glucose monitoring device which can be worn by a patient for continuous monitoring and real-time display of glucose level. In an alternate embodiment, the optimal estimator is a separate unit which can interface with different types of sensors and provide one or more outputs for display, further processing by another device, or storage on a memory device.

[0010] In one embodiment, the optimal estimator employs a priori deterministic dynamic models developed with stochastic variables and uncertain parameters to make estimates of glucose level. For example, glucose level is defined as one of the stochastic (or random) variables. Dynamic mathematical models define process propagation (i.e., how physiological and sensor parameters change in time) and measurement relationship (i.e., how physiological and sensor parameters relate to environmental conditions). Environmental conditions (e.g., temperature, humidity, pH, patient activity, etc.) can be provided to the optimal estimator intermittently or periodically via environment sensors and/or data entries by a patient or a doctor.

[0011] The optimal estimator uses dynamic models to propagate estimates of respective stochastic variables, error variances, and error covariances forward in time. At each measurement time epoch, the optimal estimator generates real-time estimates of the stochastic variables using one or more sensor outputs and any ancillary input related to environmental conditions. In one embodiment, the optimal estimator employs a linearized Kalman filter to perform optimal estimation of the stochastic variables (e.g., glucose level). In particular, an extended Kalman filter is used to accommodate nonlinear stochastic models.

[0012] Before making real-time estimates, the optimal estimator is initialized by providing initial values for the stochastic variables, error variances, and error covariances. For example, a CBG measurement or another direct glucose measurement is performed at initialization to provide a starting value for the stochastic variable corresponding to glucose level. based on the realtime estimates from the optimal estimator to obtain desirable values for the key physiological parameters.

[0013] In one embodiment, the optimal estimator, patient health monitor, and optimal controller are software algorithms which can be implemented using respective microprocessors. New information regarding process propagation or measurement relationship can be easily incorporated by modifying, reconfiguring, and/or adding to the software algorithms. The optimal estimator, patient health monitor, and optimal controller can be implemented as one joint algorithm or separate respective algorithms which function together to provide an optimal closed-loop system.

BRIEF DESCRIPTION OF THE DRAWINGS

[0014]FIG. 1A is a block diagram of one embodiment of an estimator.

[0015]FIG. 1B is a block diagram of another embodiment of a glucose-monitoring device.

[0016]FIG. 2 illustrates one embodiment of modeling physiological processes in a linearized Kalman filter application.

[0017]FIG. 3A describes one embodiment of an estimation function which depicts a linearized Kalman filter formulation.

[0018]FIG. 3B illustrates an initialization in one embodiment of an optimal estimator.

[0019]FIG. 3C illustrates a time-update cycle in accordance with one embodiment of an optimal estimator.

[0020]FIG. 3D illustrates a measurement-update cycle in accordance with one embodiment of an optimal estimator.

[0021]FIGS. 4A and 4B illustrate a first set of time history plots of optimal glucose estimates and CBG measurements with respect to time.

[0022]FIGS. 5A and 5B illustrate a second set of time history plots of optimal glucose estimates and CBG measurements with respect to time.

[0023]FIG. 6A is a block diagram of one embodiment of a patient health monitor.

[0024]FIG. 6B illustrates one embodiment of a residual test data process in the patient health monitor.

[0025]FIG. 6C illustrates one embodiment of a statistical test process in the patient health monitor.

[0026]FIG. 6D illustrates one embodiment of an input/output interface in the patient health monitor.

[0027]FIGS. 7A and 7B illustrate time history plots of residual test data with respect to measurement time.

[0028]FIG. 8 is a functional diagram of one embodiment of an, artificial pancreas.

[0029]FIG. 9A illustrates one embodiment of an optimal controller for a closed loop system.

[0030]FIG. 9B illustrates one embodiment of a control model for a controller in accordance with the present invention.

[0031]FIG. 9C illustrates one embodiment of a control algorithm.

DETAILED DESCRIPTION OF THE DRAWINGS

[0032] The present invention involves application of real-time optimal estimation, optimized real-time decisions and displays (e.g., a patient health monitor), or optimal realtime control to physiological processes. In one embodiment, the real-time optimal estimation, the optimized real-time decisions and displays, and the optimal real-time control are implemented as separate modules which can be combined functionally. In an alternate embodiment, the real-time optimal estimation, the optimized real-time decisions and displays, and the optimal real-time control are implemented as one joint algorithm.

[0033] In one embodiment, input to an optimal estimator is provided by a physical sensor for a plurality of sensors) which measures some arbitrary, but known, function (or functions) of variables or parameters to be estimated to within specified uncertainties and whose statistical characteristics are known. In one embodiment, an output of a real-time controller is provided to a physical controllable dispenser, or actuator, whose output is some known function of parameters to be controlled within specified uncertainties and whose statistical characteristics are known. In one embodiment, a decision and display function utilizes statistical testing of estimator residual errors using internally computed, and updated, estimator variances and covariances.

[0034] In one embodiment, the present invention is implemented as a software algorithm. The present invention uses models (e.g., dynamic process and measurement models). For best performance, the models should reflect the latest and most complete information available. As new and more complete information is developed, performance can be improved through incorporation of this information by simply modifying the software algorithm of the present invention.

[0035] Embodiments of the present invention will be described hereinafter with reference to the drawings. FIG. 1A is a block diagram of one embodiment of an estimator. The estimator uses a linearized Kalman filter. The linearized Kalman filter accommodates nonlinear process models and/or nonlinear measurement models. In one embodiment, the linearized Kalman filter is a discrete extended Kalman filter which is linearized after each update using best estimates.

[0036] A general formulation of a continuous-discrete extended Kalman filter is provided in Table 1. In an alternate embodiment, the linearized Kalman filter is linearized about a nominal set for which a general formulation is given in Table 2.

[0037] The estimator computes an estimator gain based on time updated and measurement updated error variable variances and covariances. In one embodiment, the estimator is implemented using discrete formulations. In an alternate embodiment, the estimator is implamented using continuous formulations. In the actual development of algorithms, one can choose a Covariance formulation or an Information formulation depending on initialization uncertainty considerations. Further, the use of Bierman factorization techniques (UDU{circumflex over ( )}T) in the implementation leads to numerically stable algorithms which are excellent for operation over very long time periods.

[0038] In one embodiment, the estimator of FIG. 1A is applied to the problem of monitoring patient glucose levels. Any type of physical sensor which measures some function of glucose can be used. In one embodiment, one or more capillary blood glucose (CBG) measurements are obtained on initialization of the estimator and when estimated glucose deviations exceed computed variance levels.

[0039] In another embodiment, additional capillary glucose values are obtained on a periodic basis to assess sensor function. As an example, CBG measurements may be obtained once or twice a day pre and one hour post prandial or when the estimator determines that the glucose values are out of range of predetermined limits.

[0040] In one embodiment, the estimator is contained in a small portable package. The estimator can be operated by a patient Alternatively, the estimator can be operated by medical staff in a hospital or clinic. The estimator (e.g., Kalman estimator) uses a Kalman filter to provided real-time estimates of patient glucose levels based upon glucose sensor measurements. The Kalman estimator can also use additional information to more closely predict time propagation of glucose levels, such as exercise, food intake, insulin administration, or other factors which influence glucose levels or the function of the sensor (e.g., local pH, temperature or oxygen tension near the physical sensor).

[0041]FIG. 1B is a block diagram of one embodiment of a glucose-monitoring device 100. The glucose-monitoring device 100 includes a glucose sensor 108, an ancillary sensor 110, a glucose estimator 114, and a patient health monitor 114. The glucose-monitoring device 100 is used to provide real-time glucose estimates of a patient 102. In one embodiment, the glucose-monitoring device 100 is an integrated unit which is portable by the patient 102 to provide continuous glucose monitoring and real-time displays.

[0042] The glucose sensor 108 (e.g., a probe, patch, infrared, or laser sensor) is coupled to the patient 102 and outputs a measurement f(g) which is a function of the glucose level of the patient 102. The glucose sensor 108 makes measurements within specified uncertainties and has known statistical characteristics. The glucose sensor 108 provides the measurement f(g) to tie glucose estimator 112. In one embodiment, the glucose sensor 108 makes measurements periodically. In an alternate embodiment, the glucose sensor 108 makes measurements intermittently or upon command.

[0043] The ancillary sensor 110 is coupled to the patient 102, the glucose sensor 108, and/or surroundings of the patient 102 and/or glucose sensor 108 to provide information regarding environmental and/or glucose sensor conditions (e.g., temperature, humidity, local pH, etc.) which affect the measurement. One or more outputs of the ancillary sensor 110 are provided to the glucose estimator 112. In one embodiment, the ancillary sensor 110 provides outputs to the patient health monitor 114 which can process the information for display or for forwarding to the glucose estimator 112. In an alternate embodiment, the ancillary sensor 110 is not a part of the glucose-monitoring device 100.

[0044] The patient 102 and/or a medical staff 104 (i.e., a user) can provide information on the environmental and glucose sensor conditions as well as other information affecting the measurement. In one embodiment, the patient 102 and/or medical staff 104 inputs information (e.g., exercise activity, food intake, insulin administration, etc.) using the patient health monitor 114. The patient health monitor 114 acts as an input/output interface or a means for the user to configure the glucose estimator 112. The patient health monitor 114 forwards the information to the glucose estimator 112. In one embodiment, the patient health monitor 114 is a display device. For example, an output of the glucose estimator 112 (e.g., an optimal realtime estimate of glucose) is provided to the patient health monitor 114 which displays the information in a comprehensible format for the patient 102 and/or the medical staff 104. The patient health monitor 114 can also contemporaneously display information provided by the glucose sensor 108, the ancillary sensor 110, the patient 102 and/or the medical staff 104 which affects the measurement used to make the optimal glucose estimate.

[0045] In another embodiment, the patient health monitor 114 is a status indicator. For example, the glucose estimator 112 provides outputs (e.g., residuals and variances) to the patient health monitor 114 which applies statistical testing to determine the reliability of the glucose sensor 108 and/or the glucose estimator 112. The patient health monitor 114 provides a warning when poor performance is detected.

[0046] In one embodiment, the glucose estimator 112 is a linearized Kalman filter (e.g., a discrete extended Kalman filter) to account for a nonlinear process model and/or measurement model. The glucose estimator (or Kalman estimator) 112 provides realtime estimates of the glucose level in the patient 102. An initialization measurement 106 (e.g., a CBG measurement) is obtained from the patient 102 and provided to the Kalman estimator 112 to initialize the Kalman estimator 112.

[0047]FIG. 2 is a flow chart illustrating one embodiment of a modeling process for physiological processes. In one embodiment, physiological processes are described by nonlinear stochastic models. In one embodiment, the flow chart of FIG. 2 illustrates one method of developing a dynamic model for an optimal estimator. The method includes steps for state vector development, nominal dynamic/measurement model development, linearized model development, and uncertainty modeling and nominal model verification.

[0048]FIG. 2 illustrates modeling of physiological processes in a linearized Kalman filter application. As an example in glucose estimation, in a first block of FIG. 2, glucose is an estimation variable. The time rate of change of glucose might become another estimation variable. An uncertain parameter might be the glucose sensor scale factor, and additionally, the rate of change of scale factor over time could be another.

[0049] In one embodiment of a second block of FIG. 2, the way in which variables and parameters nominally propagate over time may change with conditions. In the example of glucose estimation, inputs can be used to identify patient related activities: eating; exercising; sleeping; insulin injection; etc. With these identified patient related activities, additional state variables can be identified and modeled. For example, if patient eating can be related to a change in glucose level over some specified time interval, dynamics can be implemented within the estimator model which will propagate (or extrapolate) a rise in the glucose level over that time interval. This rise may be modeled by appropriate functions whose variables contain uncertainties, which may be added as elements of the stats vector. In an analogous way, decreases in glucose levels e.g., due to insulin injections) can be modeled. These models may be general in nature, or they may be patient specific. Consequently, patient related activities that have a significant impact on glucose levels, or the rate of change of glucose levels, can be accounted for within the dynamic process model. tended to decay for the remaining life of the sensor after this period of time, usually three or four days. These observations are incorporated in an embodiment of the estimator discussed in further detail below.

[0050]FIG. 3A describes an estimation function which depicts a linearized Kalman filter formulation. In one embodiment, the particular form is that of a discrete extended Kalman filter which linearizes after each update using best estimates. In the formulation, a vector whose elements comprise variables and/or parameters (with uncertainties) for making estimates defines the state of a system.

[0051] There is a distinction between variables (e.g., random variables) and parameters with uncertainty. Variables, such as glucose and rate of change of glucose, are estimated and can be controlled (if control is implemented). Parameters with uncertainty are part of the model structure not known precisely and are estimated and updated (like variables) but not controlled, e.g., a glucose sensor scale factor or insulin dispensing controller scale factor.

[0052] In one embodiment, realtime variable and parameter estimates are used to re-linearize the model following each update. Inputs to the estimator can consist of any measurement which is related to, or can be correlated with, any element in the state vector. In the case of glucose estimation, other inputs can consist of dynamic process configuration control based on patient related activities or other circumstances. Following initialization, the time update and measurement update cycles form a recursive loop. The time update period is the time interval between the receipt of measurements. This is a function of the sensor and of acceptable latency in the estimates.

[0053]FIGS. 3B, 3C and 3D illustrate, respectively, Initialization and the recursive Time Update and Measurement Update cycles according to one embodiment of the present invention. Table 3 defines, in more detail, symbols used in these figures. In one embodiment, dynamic process and measurement modeling is contained in software algorithms with parameter and structure updates in real time.

[0054] One embodiment of an initialization of the estimation process is described in FIG. 3B. A state vector estimate, Xeo, contains the initial estimates of the process variables and model parameters with uncertainty, while the covariance matrix, Po, contains the initial variances and covariances associated with the Xeo elements.

[0055]FIG. 3B shows an example embodiment with a two-element state vector which is based on empirical observations described above. As an example, the point in time when the scale factor begins to decay was chosen as 20 hours, a nominal value over the database. An exponential decay was chosen to model this decay rate and is consistent with the first derivative of scale factor equal to a parameter, alpha, multiplied by the variable scale factor. In this case, alpha is not modeled as an uncertain parameter; a value of 0.012 was chosen as a nominal value, over the database, for the five-minute cycle time of this physical sensor.

[0056] The initial estimate of glucose is 150 mg/dl (state vector element) with an initial uncertainty variance of 100 mg/dl squared (a covariance matrix element). When processing the data, the glucose element was initialized by setting it substantially equal to the first capillary blood glucose measurement. The nominal initial scale factor value, for the physical sensor, is 0.25 nano-ampsl(mg/dl) with a parameter uncertainty (variance) of 0.1 nano-ampsl(mg/dl) squared.

[0057] The initial covariance between the glucose variable and the scale factor parameter is zero. Correlation between glucose and scale factor will develop as the estimator processes the sensor measurements. Each type of sensor will have its own model and characteristics. The measurement uncertainty is 5 nano-amps squared, an element of the R matrix. In one embodiment, this is a scalar measurement and the R matrix contains a single element.

[0058] A second measurement in this example embodiment is an occasional direct measurement, such as a capillary blood glucose measurement (CBG), with a unity scale factor, and a measurement error uncertainty of 15 mg/dl squared la single element in a second R matrix). This is probably better modeled as 15% of the measured glucose value. The growth in uncertainty of glucose and scale factor from measurement to measurement is, respectively, 20 mg/dl squared and 0.002 nano-amps squared (elements of the process noise matrix, Q).

[0059]FIG. 3C illustrates a timeupdate process of the recursive process in one embodiment of an optimal estimator. In this figure, a negative superscript indicates a time update while a positive superscript indicates a measurement update. In the brackets, a letter “i” indicates time at the ith interval and (i-1) indicates time at the previous time interval. In an update process, a state vector is first updated since these elements are used to update matrices and to bring the time epoch of the estimated measurement to be consistent with that of the next measurement to be received.

[0060] In an example embodiment with a two-element state vector, the dynamic process is linear. With no patient inputs, the first derivative of the measured physiologic variable is zero, corresponding to the case when the level (on average) is as likely to either go up or to go down. No additional a priori information is assumed about the time propagation of glucose.

[0061] In one embodiment of estimating glucose, the solution to the scale factor propagation after the first 20 hours is defined by the exponential shown in the second column. Consequently, for this embodiment, the dynamic process function (f), is linear, is not a function of state vector elements, and, from linear system theory, the transition matrix (A) is the 2 by 2 identity matrix for the first 20 hours and thereafter is defined by the 2 by 2 matrix in the second column.

[0062] In one embodiment, the measurement function (h) for the sensor measurement is non-linear in the state vector elements. If Ge and Se are used to denote glucose and scale factor estimates, respectively, then Ye=Se*Ge. Definitions of the above terms are provided in Table 3. When linearized using best estimates, the linearized measurement matrix H=[Se Ge] and is of the same functional form both before and after 20 hours.

[0063]FIG. 3D illustrates a measurement-update process of one embodiment of an optimal estimator. The measurement update sequence begins with the computation of the gain matrix, K(i). The difference between the actual sensor measurement and the best estimate of the measurement is computed: y(i)=Ym(i)·Se(i)*Ge(i). This difference, or residual when multiplied by the gain matrix and added to the time-updated estimate produces the measurement-updated estimate.

[0064] The covariance matrix is then measurement updated, reflecting the level of uncertainty in the estimates following the processing of a measurement. In the glucose example, if a second measurement is available, such as a CBG, then the measurement sequence is again cycled through, starting with a new gain computation, and using the appropriate measurement matrix and new best estimate of the next measurement. Following the processing of all available measurements at the ith time epoch, the updated state vector and covariance matrix are then used to start the time update for the (i+1)th time epoch which begins the next cycle.

[0065] One embodiment of an estimation algorithm illustrating the initialization, the time update process, and the measurement update process discussed above is provided in Table 4. Table 4 is an algorithm programmed in the MATLAB language (from Math Works). This printout defines a working program and has been used to process a significant number of data sets. In the glucose example, the estimation results from the process of two data files, both gathered from the same patient, and taken about a month apart, are shown in FIGS. 4A, 4B, 5A, and 5B.

[0066] In one embodiment, sensor inputs are provided and processed every 5 minutes. Occasional CBGs are also provided. For example, two CBGs per day were processed by an estimator; and additional CBG values were used to judge estimator performance by comparing glucose estimates with actual CBG values not used by the estimator.

[0067]FIGS. 4A and 4B illustrate a first set of time history plots of optimal glucose estimates and CBG measurements with respect to time. FIG. 4A shows a time history of the realtime estimates of glucose (e.g., every 5 minutes) along with all available discrete CBGs.

[0068]FIG. 4B shows a time history of the glucose estimates along with CBGs that were processed. In this figure, the estimated glucose value took several rapid swings between approximately 48 hours and 58 hours. FIG. 4B indicates that only sensor measurements were processed during that interval and no CBGs were processed. However, the CBGs plotted in FIG. 4A indicate that the glucose estimates did tend to follow the excursions of the patient glucose levels.

[0069]FIGS. 5A and 5B illustrate a second set of time history plots of optimal glucose estimates and CBG measurements with respect to time. The time duration for these runs is about 4 days without patient inputs. Over this time period, the patient ate, slept, exercised, and took insulin injections. Dynamic models to account for these activities, much like the decaying scale factor, could be implemented and called into use upon command.

[0070]FIG. 6A is a block diagram of one embodiment of a patient health monitor. On example of an algorithm for the patient health monitor is in Table 4 which generates statistical test data based on Kalman filter residuals as well as test displays. In one embodiment, the patient health monitor generates realtime decisions and displays which are integrated with a Kalman filter. The patient health monitor allows the patient or medical staff to interact with a Kalman estimator and/or Kalman controller described herein.

[0071] In one embodiment, the patient health monitor provides insight into how well a Kalman filter is working through the filter residual that is the difference between the estimate of the measurement at the time the measurement is received and the actual measurement. In another embodiment, other checks are used from time to time, such as the CBGs in the glucose example described above. An example of another check on the status of a sensor is through the use of patient inputs or signals indicating that something is changing in a prescribed way and then noting whether or not the sensor is observing this change within prescribed uncertainties.

[0072] In one embodiment, the real-time displays and decisions of the patient health monitor uses some occasional outside checks but relies substantially on results of statistical testing performed on filter residuals. If estimates of the available measurements at the ith time epoch, the updated state vector and covariance matrix are then used to start the time update for the (i+1)th time epoch which begins the next cycle.

[0073] One embodiment of an estimation algorithm illustrating the initialization, the time update process, and the measurement update process discussed above is provided in Table 4. Table 4 is an algorithm programmed in the MATLAB language (from Math Works). This printout defines a working program and has been used to process a significant number of data sets. In the glucose example, the estimation results from the process of two data files, both gathered from the same patient, and taken about a month apart, are shown in FIGS. 4A, 4B, 5A, and 5B.

[0074] In one embodiment, sensor inputs are provided and processed every 5 minutes. Occasional CBGs are also provided. For example, two CBGs per day were processed by an estimator; and additional CBG values were used to judge estimator performance by comparing glucose estimates with actual CBG values not used by the estimator.

[0075]FIGS. 4A and 4B illustrate a first set of time history plots of optimal glucose estimates and CBG measurements with respect to time. FIG. 4A shows a time history of the realtime estimates of glucose (e.g., every 5 minutes) along with all available discrete CBGs.

[0076]FIG. 4B shows a time history of the glucose estimates along with CBGs that were processed. In this figure, the estimated glucose value took several rapid swings between approximately 48 hours and 58 hours. FIG. 4B indicates that only sensor measurements were processed during that interval and no CBGs were processed. However, the CBGs plotted in FIG. 4A indicate that the glucose estimates did tend to follow the excursions of the patient glucose levels.

[0077]FIGS. 5A and 5B illustrate a second set of time history plots of optimal glucose estimates and CBG measurements with respect to time. The time duration for these runs is about 4 days without patient inputs. Over this time period, the patient ate, slept, exercised, and took insulin injections. Dynamic models to account for these activities, much like the decaying scale factor, could be implemented and called into use upon command.

[0078]FIG. 6A is a block diagram of one embodiment of a patient health monitor. On example of an algorithm for the patient health monitor is in Table 4 which generates statistical test data based on Kalman filter residuals as well as test displays. In one embodiment, the patient health monitor generates realtime decisions and displays which are integrated with a Kalman filter. The patient health monitor allows the patient or medical staff to interact with a Kalman estimator and/or Kalman controller described herein.

[0079] In one embodiment, the patient health monitor provides insight into how well a Kalman filter is working through the filter residual that is the difference between the estimate of the measurement at the time the measurement is received and the actual measurement. In another embodiment, other checks are used from time to time, such as the CBGs in the glucose example described above. An example of another check on the status of a sensor is through the use of patient inputs or signals indicating that something is changing in a prescribed way and then noting whether or not the sensor is observing this change within prescribed uncertainties.

[0080] In one embodiment, the real-time displays and decisions of the patient health monitor uses some occasional outside checks but relies substantially on results of statistical testing performed on filter residuals. If estimates of the measurements are, on average, good (e.g., residuals are small and unbiased), then the estimator is generally working well, and vice versa. More specifically, elements of the covariance matrix can be used to construct statistical test applications.

[0081] For hospital applications, realtime displays of glucose estimates along with real-time displays of estimator performance test results can be important visual inputs to the medical staff. Requests for additional CBG measurements or the sounding of an alarm in the event glucose estimates exceed critical limits may also prove useful. In one embodiment, a reduced number of outputs is provided in relatively small estimators for individual use.

[0082]FIG. 6B illustrates one embodiment of a residual test data process in the patient health monitor. For example, the residual (y), covariance matrix (P), measurement matrix (H), and measurement noise matrix (R) are available from an estimator algorithm at each time epoch (i). If the estimator is operating properly, the sequence of residuals has the property of zero mean, white noise sequence, i.e., any two residuals taken at different times are uncorrelated (E[y(i)*y(i)]=0, for all j not equal to i). This condition provides a unique means for constructing statistical tests.

[0083] Visually, a time history plot of the residuals, Sy(i) in FIG. 6B, should appear random, zero mean, and unbaised. If they are summed over time, the deviation of the sum from zero should, on average, grow as the square root of time, as should its absolute value, ASy(i). The fact that E[y(i)*y(j)]=0, for i not equal to j, also means that the sum of the variances, SV(i) in FIG. 6B, which is easily computed, is equal to the variance of the sum of residuals for a properly performing estimator. The standard deviation of the sum of residuals, StdSV(i) also grows as the square root of time.

[0084]FIG. 6C illustrates one embodiment of a statistical test process in the patient health monitor. FIG. 6C defines statistical tests which can be constructed based on filter residual test data. One of these compares the absolute value of the sum of the residuals with the standard deviation of the sum of residuals. On average, the ASy(i) should be bounded by the StdSV(i). If not, this indicates that the deviations of Sy(i) are growing faster than that of a white noise sequence, implying degraded estimator performance.

[0085] Real-time displays of ASy(i) and StdSVfi) histories can provide a visual picture of estimator performance. An example is provided in FIGS. 7A and 7B which illustrate time history plots of residual test data with respect to measurement time. These two plots are one form of residual tests for the two sets of glucose estimation results provided in FIGS. 4A, 4B, 5A, and 5B respectively. In both cases, the sum of residuals are well behaved and was bounded by the Standard Deviation, Std, of the sum of residuals.

[0086] The example embodiment for the glucose application of test data, test generation, and test result display described above is implemented by the algorithm in Table 4. Other realtime quantitative tests can also be constructed using these data. Tests on individual residuals can be performed using individual variances. If a measurement is received which causes the residual to exceed a four signal level, for example, the action might be to emit a warning and request an immediate CBG measurement. Other tests are identified in FIG. 6C and will be evaluated as the system develops.

[0087]FIG. 8D illustrates one embodiment of an input/output interface in the patient health monitor. The patient health monitor provides a capability for the patient and/or staff to communicate and interact in real time with estimation and control processes using simple commands, visual displays, and audio outputs described above. Confidence levels in estimator performance can be established and a genuine interface established whereby the estimation and control processes could request additional information to check and insure confidence in estimates, physical sensors, and physical controllers. The staff can provide useful real-time inputs to augment this process.

[0088]FIG. 8 is a block diagram of one embodiment of a Kalman optimal stochastic control solution as applied to physiological processes. In one embodiment, the application includes both optimal stochastic regulator and optimal stochastic tracking control solutions. Tracking control involves a controlled variable following a reference value, constant or dynamic, as closely as possible. Control is applied to physiological processes, wherein a control gain is computed based upon optimization criteria which minimizes controlled variable errors while minimizing application of control based on cost weightings.

[0089] There is a duality between the computation of a Kalman estimator gain and a Kalman control gain. The Kalman estimator gain minimizes estimation error variances. The Kalman control gain minimizes variances of error between the controlled variables and the reference variables while minimizing the level of control applied. As a result, the optimal control function includes specification of the controlled variables and their associated costs as well as costs associated with the amount of control to be applied. For example, smaller control variable error costs and larger control application costs will allow the controlled variable to deviate farther from the reference, but with reduced application of control.

[0090] In one embodiment, linearization techniques described above in association with the Kalman estimator is applied to physiological nonlinear stochastic processes. For example, linearization about nominal values or about best estimates are provided by the Kalman estimator. Uncertain parameters associated with a controllable dispenser, or actuator, are included in an estimator state vector.

[0091] The optimal stochastic controller can use linear or nonlinear formulations and discrete or continuous time formulations. In one embodiment, the optimal stochastic controller is used with an optimal estimator described herein and/or an optimized decision and display function also described herein to form a closed loop system. The closed loop system works as an artificial pancreas when applied to a glucose problem in one embodiment.

[0092]FIG. 8 is a functional diagram showing a controllable dispenser, or pump, with the capability to secrete insulin and glucagon to control high and low levels, respectively. In one embodiment of a closed loop system, an estimator and a controller share a state vector wherein the estimator estimates it and the controller controls designated elements of it. Unlike the estimator, the time varying gain computations for the controller is computationally intensive and may not be used in all applications. The controller includes time varying or steady state gain formulations.

[0093]FIG. 9A illustrates one embodiment of an optimal controller for the artificial pancreas. The glucose control problem is a tracking problem since the glucose level is controlled to a desired level which may either be constant or a function of time In one embodiment, the dynamic process model includes a quantitative description of how glucose levels propagate, in time, as a function of insulin/glucagon secreted by the controllable pump. The dynamic process model is described by a system of first order differential or difference equations. Excluding the pump, much of the modeling for the glucose control is available through the estimator modeling development.

[0094]FIG. 9B illustrates one embodiment of a control model for a controller. In an example embodiment, the dynamic process model is described by three first order differential equations that are forced by a control variable, u. The dynamics of this process include a first order time lag and a scale factor associated with the pump, and a first order time lag and a scale factor associated with the physiological process. The model for the glucose sensors is the same as in the example glucose estimator embodiment. In the definition of the elements of the transition matrix, alpha g, s, and d are the inverse of the first order time lags associated with glucose, glucose sensor scale factor, and pump, respectively. Beta g is the glucose scale factor multiplied by alpha g. Delta t is the time interval between measurement/control application epochs. The controlled error is the difference between the estimate of glucose (provided by the estimator) and the glucose control point input.

[0095] In a controller command, Beta d is a pump scale factor multiplied by alpha d. The measurements are the same as for the example glucose estimator, except that the measurements contain an additional zero since the measurements are not functions of the variable insulin/glucagon.

[0096] The cost function, which is minimized by the optimal stochastic control, contains costs associated with the glucose error and the application of control. Choosing a value of Cu that is much larger than Cg will result in a relative gentle application of control. Another example embodiment would utilize a higher order model in which the first derivative of glucose would be included in the state vector, and included as a control variable. If a relatively large cost is associated with the first derivative relative to the glucose control point error, then the control will be very active when rapid changes in patient glucose occur while relatively gentle otherwise. Other example embodiments would include pump scale factor as a state vector element (uncertain parameter) as well as insulin/glucagon measurements to the estimator.

[0097]FIG. 9C illustrates one embodiment of a control algorithm based on the model defined in FIG. 9B. Using either a time varying gain or a precomputed steady state gain, control is applied at each epoch based upon a difference between an estimate of a patient glucose level and a glucose control point. A control, u, is applied to a pump over each time interval, and a state vector is time updated as indicated in this figure using the control variable, u, as a forcing function. Other time updates are performed in accordance with embodiments discussed above in association with estimator equations.

[0098] A potential problem in the application of closed loop control to that of physiological processes is due to potentially long time delays that may be destabilizing. These delays can be in the form of transport lags. A transport lag is the time between when control is applied and when the process action begins. An optimal technique for control using delay states is discussed in “Optimal Control of Linear Stochastic Systems with Process and Observation Time Delays” by E. J. Knobbe (Academic Press, Inc., 1989) and is hereby incorporated herein in its entirety by reference thereto. A discussion of principles developed for optimal control with process and observation time delays is provided in Table 5.

[0099] Although described above in connection with particular embodiments of the present invention, it should be understood that the descriptions of the embodiments are illustrative of the invention and are not intended to be limiting. Various modifications and applications may occur to those skilled in the art without departing from the true spirit and scope of the invention. TABLE 1 SUMMARY OF CONTINUOUS-DISCRETE EXTENDED KALMAN FILTER System Model ${{\overset{.}{\underset{\_}{x}}(t)} = {{\underset{\_}{f}\left( {{\underset{\_}{x}(t)},t} \right)} + {\underset{\_}{w}(t)}}};\quad {\left. {\underset{\_}{w}(t)} \right.\sim{N\left( {\overset{.}{\underset{\_}{0}},{Q(t)}} \right)}}$

Measurement Model ${{{\underset{\_}{z}}_{k} = {{{\underset{\_}{h}}_{k}\left( {\underset{\_}{x}\left( t_{k} \right)} \right)} + {\underset{\_}{v}}_{k}}};\quad {k = 1}},2,{\ldots \quad;\quad {\left. {\underset{\_}{v}}_{k} \right.\sim{N\left( {\underset{\_}{0},R_{k}} \right)}}}$

Initial Conditions $\left. {\underset{\_}{x}(0)} \right.\sim{N\left( {{\hat{\underset{\_}{x}}}_{0},P_{0}} \right)}$

Other Assumptions ${E\left\lbrack {{\underset{\_}{w}(t)}{\underset{\_}{v}}_{k}^{T}} \right\rbrack} = {0\quad {for}\quad {all}\quad k\quad {and}\quad {all}\quad {t.}}$

State Estimate Propagation ${\overset{.}{\hat{\underset{\_}{x}}}(t)} = {\underset{\_}{f}\left( {{\hat{\underset{\_}{x}}(t)},t} \right)}$

Error Covariance Propagation ${\overset{.}{P}(t)} = {{{F\left( {{\hat{\underset{\_}{x}}(t)},t} \right)}{P(t)}} + {{P(t)}{F^{T}\left( {{\hat{\underset{\_}{x}}(t)},t} \right)}} + {Q(t)}}$

State Estimate Update ${{\hat{\underset{\_}{x}}}_{k}( + )} = {{{\hat{\underset{\_}{x}}}_{k}( - )} + {{\overset{\_}{K}}_{k}\left\lbrack {{\underset{\_}{z}}_{k} - {{\underset{\_}{h}}_{k}\left( {{\hat{\underset{\_}{x}}}_{k}( - )} \right)}} \right\rbrack}}$

Error Covariance Update ${{\underset{\_}{P}}_{k}( + )} = {\left\lbrack {1 - {K_{k}{H_{k}\left( {{\hat{\underset{\_}{x}}}_{k}( - )} \right)}}} \right\rbrack \quad {{\overset{.}{P}}_{k}( - )}}$

Gain Matrix $K_{k} = {{P_{k}( - )}{{H_{k}^{T}\left( {{\hat{\underset{\_}{x}}}_{k}( - )} \right)}\left\lbrack {{{H_{k}\left( {{\hat{\underset{\_}{x}}}_{k}( - )} \right)}{P_{k}( - )}{H_{k}^{T}\left( {{\hat{\underset{\_}{x}}}_{k}( - )} \right)}} + R_{k}} \right\rbrack}^{- 1}}$

Definitions $\begin{matrix} {{{F\left( {{\hat{\underset{\_}{x}}(t)},t} \right)} = \frac{\partial{\underset{\_}{f}\left( {{\underset{\_}{x}(t)},t} \right)}}{\partial{\underset{\_}{x}(t)}}}}_{{\underset{\_}{x}{(t)}}^{c}{\hat{\underset{\_}{x}}{(t)}}} \\ {{{H_{k}\left( {{\hat{\underset{\_}{x}}}_{k}( - )} \right)} = \frac{\partial{{\underset{\_}{h}}_{k}\left( {\underset{\_}{x}\left( t_{k} \right)} \right)}}{\partial{\underset{\_}{x}\left( t_{k} \right)}}}}_{{\underset{\_}{x}{(t_{k})}} = {{\hat{\underset{\_}{x}}}_{k}{( - )}}} \end{matrix}\quad$

[0100] TABLE 2 SUMMARY OF CONTINUOUS-DISCRETE LINEARIZED KALMAN FILTER System Model ${{\overset{.}{\underset{\_}{x}}(t)} = {{\underset{\_}{f}\left( {{\underset{\_}{x}(t)},t} \right)} + {\underset{\_}{w}(t)}}};\quad {\left. {\underset{\_}{w}(t)} \right.\sim{N\left( {\overset{.}{\underset{\_}{0}},{Q(t)}} \right)}}$

Measurement Model ${{{\underset{\_}{z}}_{k} = {{{\underset{\_}{h}}_{k}\left( {\underset{\_}{x}\left( t_{k} \right)} \right)} + {\underset{\_}{v}}_{k}}};\quad {k = 1}},2,{\ldots \quad;\quad {\left. {\underset{\_}{v}}_{k} \right.\sim{N\left( {\underset{\_}{0},R_{k}} \right)}}}$

Initial Conditions $\left. {\underset{\_}{x}(0)} \right.\sim{N\left( {{\hat{\underset{\_}{x}}}_{0},P_{0}} \right)}$

Other Assumptions $\begin{matrix} {{E\left\lbrack {{\underset{\_}{w}(t)}\quad {\underset{\_}{v}}_{k}^{T}} \right\rbrack} = {0\quad {for}\quad {all}\quad k\quad {and}\quad {all}\quad t}} \\ {{Nominal}\quad {trajectory}\quad {\overset{\_}{\underset{\_}{x}}(t)}\quad {is}\quad {available}} \end{matrix}\quad$

State Estimate Propagation ${\overset{.}{\hat{\underset{\_}{x}}}(t)} = {{\underset{\_}{f}\left( {{\overset{\_}{\underset{\_}{x}}(t)},t} \right)} + {{\overset{\_}{F}\left( {{\overset{\_}{\underset{\_}{x}}(t)},t} \right)}\left\lbrack {{\hat{\underset{\_}{x}}(t)} - {\overset{\_}{\underset{\_}{x}}(t)}} \right\rbrack}}$

Error Covariance Propagation ${\overset{.}{P}(t)} = {{{F\left( {{\overset{\_}{\underset{\_}{x}}(t)},t} \right)}{P(t)}} + {{P(t)}{F^{T}\left( {{\overset{\_}{\underset{\_}{x}}(t)},t} \right)}} + {Q(t)}}$

State Estimate Update ${{\hat{\underset{\_}{x}}}_{k}( + )} = {{{\hat{\underset{\_}{x}}}_{k}( - )} + {K_{k}\left\lbrack {{\underset{\_}{x}}_{k} - {{\underset{\_}{h}}_{k}\left( {\hat{\underset{\_}{x}}\left( t_{k} \right)} \right)} - {{H_{k}\left( {\overset{\_}{\underset{\_}{x}}(t)} \right)}\left\lbrack {{{\hat{\underset{\_}{x}}}_{k}( - )} - {\overset{\_}{\underset{\_}{x}}\left( t_{k} \right)}} \right\rbrack}} \right\rbrack}}$

Error Covariance Update ${P_{k}( + )} = {\left\lbrack {1 - {K_{k}{H_{k}\left( {\overset{\_}{\underset{\_}{x}}\left( t_{k} \right)} \right)}}} \right\rbrack {P_{k}( - )}}$

Gain Matrix $K_{k} = {{{\overset{.}{P}}_{k}( - )}{{H_{k}^{T}\left( {\overset{\_}{\underset{\_}{x}}\left( t_{k} \right)} \right)}\left\lbrack {{{H_{k}\left( {\overset{\_}{\underset{\_}{x}}\left( t_{k} \right)} \right)}{P_{k}( - )}{H_{k}^{T}\left( {\overset{\_}{\underset{\_}{x}}\left( t_{k} \right)} \right)}} + R_{k}} \right\rbrack}^{- 1}}$

Definitions $\begin{matrix} {{{F\left( {{\hat{\underset{\_}{x}}(t)},t} \right)} = \frac{\partial{\underset{\_}{f}\left( {{\underset{\_}{x}(t)},t} \right)}}{\partial{\underset{\_}{x}(t)}}}}_{{\underset{\_}{x}{(t)}} = {\overset{\_}{\underset{\_}{x}}{(t)}}} \\ {{{H_{k}\left( {\overset{\_}{\underset{\_}{x}}\left( t_{k} \right)} \right)} = \frac{\partial{{\underset{\_}{h}}_{k}\left( {\underset{\_}{x}\left( t_{k} \right)} \right)}}{\partial{\underset{\_}{x}\left( t_{k} \right)}}}}_{{\underset{\_}{x}{(t_{k})}} = {{\overset{\_}{\underset{\_}{x}}}_{k}{(t_{k})}}} \end{matrix}\quad$

[0101] TABLE 3 State Vector X, Xe, Xe(0): These symbols denote, respectively, the state vector, the best estimate (or optimal estimate) of the state vector, and the initial best estimate of the state vector. They contain both variables and parameters as defined above and, with regard to estimation, there are no distinctions. Dynamic Process Model dX = f(X,t) , dXe = f(Xe,t): These symbols denote the time derivative of the state vector and estimated state vector, respectively. They represent a system of first order differential equations (or difference equations) which describe the manner in which the state elements propagate in time. The function, f, may be linear or nonlinear. Measurement Model Ym = h(X) + e, Ye = h(Xe): These symbols denote the actual measurement and the best estimate of the measurement, respectively. The function, h, defines the arbitrary, but known, way in which the state vector elements are related to the measurement, and e represents the sensor measurement error. Covariance Matrix P, P(0): Denotes, respectively, the matrix of variances and co-variances associated with the errors of each of the state variable estimates (within the estimated state vector) and their initial values, Transition Matrix A, A(0): Denotes the transition matrix, which is used to propagate the covariance matrix forward it time (time update), and it's initial value, respectively; in the linear case it is also used to time update the state vector estimate. Process Noise Matrix Q: Denotes the matrix of variances and co-variances associated with error growth uncertainty accumulated in the state variable estimates since the last measurement update, Measurement Matrix H, H(0): Denotes the measurement matrix and it's initial value, respectively. This matrix defines the linear functional relationship between the measurement and the state vector elements. If, the measurement model is linear, then H = h; if h is non-linear, then H is defined by linearizing h using partial derivatives or perturbation techniques. Measurement Noise Matrix R: Denotes the matrix of variances and co-variances associated with measurement error uncertainties. Kalman Gain Matrix K: Denotes the Kalman gain matrix which, when multiplied by the difference between the actual measurement, and the best estimate of the measurement, yields the estimated state correction. This estimated state correction, when added to the old best estimate, becomes the new best estimate. Estimated Measurement Error (Residual) y = Ym − Ye: Denotes the difference between the actual measurement and the best estimate of the measurement. This difference multiplied by the Kalman gain yields the correction to the previous state vector estimate.

[0102] TABLE 4 % Optimal Glucose Estimator, Extended Kalman Filter; Computes Statistical Test Data for Patient Health Monitor %Ed_JYP_Estimator; Two-step scale-factor model, Exp = .999 for t>20; r=15{circumflex over ( )}2 for y<10 ; x=[150;.25]; hh=[1 0];p=[100{circumflex over ( )}2 0 ; 0 .1{circumflex over ( )}2];a=[1 0 ; 0 1]; q=[20{circumflex over ( )}2 0 ; 0 .002{circumflex over ( )}2]; rr= 15{circumflex over ( )}2; r= 5{circumflex over ( )}2; I=[1 0;0 1]; load EdJY528.prn. [m,n]=size(EdJY528), t=EdJY528(:,1)/12; y=EdJY528(:,2); g=EdJY528(:,3); gm=EdJY528(:,4); x=[gm(1);.25]; sz=0.0; SVZ = p(1,1)*x(2){circumflex over ( )}2 + p(2,2)*x(1){circumflex over ( )}2; for i = 1:m;... r = 5{circumflex over ( )}2;... zz = 0;... if y(i) < 10 r = 15{circumflex over ( )}2;... end; if t(i) > 20  a=[1 0 ; 0 .999];... end; p=a*p*a′+q;... x=a*x;... if gm(i) > 0 k=p*hh′ / (hh*p*hh′+rr);... zz=(gm(i)−x(1));... x=x=k*zz;... p=(I−k*hh) *p;... end; h=[x(2) x(1) ];... k=p*h′/(h*p*b′+r);... z=(y(i)−x(1)*x(2));... x=x+k*z;... p=(I−k*h)*p;... az=abs(z);... sz=sz+z;... asz = abs(sz);... VZ = p(1,1)*x(2){circumflex over ( )}2 + p(2,2)*x(1){circumflex over ( )}2 + 2*p(1,2)*x(1)*x(2)+ r ;... sigZ = sqrt(VZ);... SVZ = SVZ = VZ;... sigSZ = sqrt(SVZ);... VZZ = p(1,1) + rr;... sigZZ = sqrt(VZZ);... azz = abs(zz);... xhistory(i,1) = x(1);... xhistory(i,2) = x(2);... gmhistory =gm;... ghistory =g;... zhistory(i) =z;... sigsz_history(i) = sigSZ;... sigz_history(i) = 2*sigZ;... aszhistory(i) = asz;... azhistory(i) = az;... zzhistory(i) = zz;... sigzz_history(i) = 2*sigZZ;... azzhistory(i) = azz;... sig_history(i,1)=sqrt(p(1,1));... sig_history(i,2)=sqrt(p(2,2));... yhistory=y;... end; figure (1) plot(t,xhistory(:,2)); xlabel(′ Measurement Time (hrs)′); ylabel(′Scale Factor Estimate; (ISIG Units/ (mg/dl))′); title(′Scale Factor Estimate vs Time′); figure (2) plot(t,gmhistory(:),t,xhistozy(:,1)); xlabel(′Time (hrs)′); Ylabel(′Glucose Meas & Estimated Glucose; (mg/dl)′); title(′All Glucose Measurements & Estimated Glucose vs Time′); figure (3) plot(t,yhistory(:),t,zhistory(:)); xlabel(′Time (hrs)′); Ylabel(′ISIG Meas & z Residual; (ISIG Units) ′); title(′ISIG Measurement & z residual vs Time′); figure (4) plot(t,xhistory(:,1),t,ghistory(:,1)); xlabel(′Time (hrs)′); ylabel(′Glucose & Estimated Glucose; (mg/dl)′); title(′Glucose Estimate & All Glucose CBGs vs Time′); figure (5) plot(t,sigzz_history(:),t,azzhistory(:)); xlabel(′Time (hrs)′); ylabel(′Abs(zz) Residual & two sigma(zz); (mg/dl)′); title(′Residual Test: 2 Sigma(zz) & Abs(zz) Residual vs Time′); figure (6) plot(t,azhistory(:),t,sigz_history(:)); xlabel(′ Measurement Time (hrs)′); ylabel(′z Residual & Standard Deviation; (ISIG Units)′); title(′Residual Test : Abs(z) & 2 Sigma(z) vs Time′); figure (7) plot(t,aszhistory(:),t,sigsz_history(:)); xlabel(′ Measurement Time (hrs)′); ylabel(′ sz Residual & Sigma; (ISIG Units) ′); title(′Residual Test : Abs(sz) & Sigma(sz) vs Time′);

[0103] TABLE 5 PROBLEM DEFINITION The general, discrete-time system representation with explicit process and observation time delays is given by $\begin{matrix} {{{x\left( {k + 1} \right)} = {{\sum\limits_{i = 1}^{q}{{A_{i}(k)}{X\left( {k + 1 - i} \right)}}} + {{B(k)}{U(k)}} + {W_{1}(k)}}},} & (1) \end{matrix}$

$\begin{matrix} {{{Y(k)} = {{\sum\limits_{j = 1}^{p}{{C_{j}(k)}{X\left( {k + 1 - j} \right)}}} + {W_{2}(k)}}},} & (2) \end{matrix}$

where p and q are integers > 1; W₁ and W₂ are zero-mean white-noise sequences such that ${{\left. \begin{matrix} {{E\left\{ {{W_{1}(k)}{W_{1}^{T}(k)}} \right\}} = {V_{1}(k)}} \\ {{E\left\{ {{W_{2}(k)}{W_{2}^{T}(k)}} \right\}} = {V_{2}(k)}} \\ {{E\left\{ {{W_{1}(i)}{W_{2}^{T}(j)}} \right\}} = 0} \end{matrix} \right\} \quad \forall_{i,j,k}};}\quad$

Y is an m × 1 observation vector; X is an n × 1 random state vector whose initial uncertainty is uncorrelated with W₁ and W₂ and with initial covariance Q₀; and U is the control input vector. The objective is to find the control function (functional) U(k) for k = 1, 2, . . . that minimizes an expected quadratic cost function for the linear stochastic regulator defined by Eqs. (1) and (2). Because linear stochastic tracking problems can be formulated as linear stochastic regulator problems by combining the reference and plant models in an augmented system [3], this system representation applies equally to the tracking problem. PROBLEM FORMULATION AND SOLUTION The system representation defined by Eqs. (1) and (2) can be cast in stochastic regulator form by augmenting the state vector with the time-delayed states, that is, $\begin{matrix} {{{\overset{\_}{X}\left( {k + 1} \right)} = {{{\overset{\_}{A}(k)}{\overset{\_}{X}(k)}} + {{\overset{\_}{B}(k)}{U(k)}} + {{\overset{\_}{W}}_{1}(k)}}},} & (3) \end{matrix}$

and $\begin{matrix} {{Y(k)} = {{{\overset{\_}{C}(k)}{\overset{\_}{X}(k)}} + {W_{2}(k)}}} & (4) \end{matrix}$

${{\overset{\_}{A}(k)}\overset{\Delta}{=}\begin{bmatrix} 0 & I & 0 & \cdots & \quad & 0 \\ \quad & 0 & \quad & \quad & ⋰ & \quad \\ \vdots & \quad & \quad & ⋰ & \quad & \vdots \\ \quad & \quad & ⋰ & \quad & \quad & 0 \\ 0 & \quad & \quad & \cdots & 0 & I \\ {A_{h}(k)} & \quad & \quad & \cdots & \quad & {A_{1}(k)} \end{bmatrix}},\quad {{\overset{\_}{X}(k)}\overset{\Delta}{=}\begin{bmatrix} {X\left( {k - h + 1} \right)} \\ {X\left( {k - h + 2} \right)} \\ \vdots \\ {X\left( {k - 1} \right)} \\ {X(k)} \end{bmatrix}},$

${{\overset{\_}{B}(k)}\overset{\Delta}{=}\begin{bmatrix} 0 \\ \vdots \\ 0 \\ {B(K)} \end{bmatrix}},\quad {{\overset{\_}{W}(k)}\overset{\Delta}{=}\begin{bmatrix} 0 \\ \vdots \\ 0 \\ {W_{1}(K)} \end{bmatrix}},\quad {{\overset{\_}{C}(k)}^{T}\overset{\Delta}{=}\begin{bmatrix} {C_{h}(k)} \\ {C_{h - 1}(k)} \\ \vdots \\ {C_{2}(k)} \\ {C_{1}(k)} \end{bmatrix}},$

and the dimensionality of the system is defined by h, where h = max(p, q). In Eq. (3), the control remains the same as in Eq. (1) because, physically, past states cannot be changed or controlled, in Eq. (4) the observation Y and the observation noise W₂ also remain unchanged. In Eqs. (1) and (2), p and q are not, in general. equal. For example, if thc observation is not a linear function of all the delayed slates contained in {overscore (X)}. then h = q > p, and the appropriate (q − p) submatrices in {overscore (C)}. of Eq. (4). are set equal to zero. If the proeess evolution is not a linear function of all thc delayed states contained in {overscore (X)}, then h = p > q, and the appropriate submatrices in {overscore (A)}. of Eq. (3), are set equal to zero. The dimensions of {overscore (B)} and {overscore (W)}₁, in Eq. (3). must also be consistent with the integer h. Therefore, without loss of generality, the system defined by Eqs. (1) and (2) can be represented by the augmented system model described by Eqs. (3) and (4). Given that the control is to minimize the expected value of a quadratic cost function of the form, $\begin{matrix} {{E\left\{ {{\sum\limits_{k = k_{0}}^{k_{1} - 1}\left\lbrack {{{\overset{\_}{X}(k)}^{T}{{\overset{\_}{R}}_{1}(k)}{\overset{\_}{X}(k)}} + {{U^{T}(k)}{R_{2}(k)}{U(k)}}} \right\rbrack} + {{\overset{\_}{X}\left( k_{1} \right)}{\overset{\_}{P}\left( k_{1} \right)}{\overset{\_}{X}\left( k_{1} \right)}}} \right\}},} & (5) \end{matrix}$

then the separation principle applies [3]. Also, the optimal linear stochastic control of the augmented system is given by a deterministic, optimal linear controller with state input {overscore (X)} (or estimated state feedback), which is provided by an optimal one-step predictor using the augmented model [4]. That is, $\begin{matrix} {{{U(k)} = {{{{- {\overset{\_}{F}(k)}}{\hat{X}(k)}}:\quad k} = k_{0}}},{k_{0} + 1},\ldots \quad,k_{1},} & (6) \end{matrix}$

where the control gain {overscore (F)} satisfies $\begin{matrix} {\begin{matrix} {{\overset{\_}{F}\left( \text{k} \right)} = \left\{ {{R_{2}(k)} + {{{\overset{\_}{B}}^{T}(k)}\left\lbrack {{{\overset{\_}{R}}_{1}\left( {k + 1} \right)} +} \right.}} \right.} \\ {{\left. {{\overset{\_}{P}\left\lbrack {k + 1} \right\rbrack}{B(k)}} \right\}^{- 1}{B^{T}\left\lbrack {{\overset{\_}{R}\left( {k + 1} \right)} + {P\left( {k + 1} \right)}} \right\rbrack}{\overset{\_}{A}(k)}};} \end{matrix}\quad} & (7) \end{matrix}$

the matrix {overscore (P)} satisfies the recursive matrix Riccati equation; $\begin{matrix} {{\overset{\_}{P}(k)} = {{{\overset{\_}{A}}^{T}(k)}\left\lbrack {{{{\overset{\_}{R}}_{1}\left( {k + 1} \right)} + {{\overset{\_}{P}\left( {k + 1} \right\rbrack}\left\lbrack {{\overset{\_}{A}(k)} - {{\overset{\_}{B}(k)}{\overset{\_}{F}(k)}}} \right\rbrack}};} \right.}} & (8) \end{matrix}$

$\begin{matrix} {{the}\quad {one}\text{-}{step}\quad {predictor}\quad {output}\quad \hat{\overset{\_}{X}}\quad {is}\quad {defined}\quad {by}} \\ {{{\hat{\overset{\_}{X}}\left( {k + 1} \right)} = {{{\overset{\_}{A}(k)}{\hat{\overset{\_}{X}}(k)}} + {{\overset{\_}{B}(k)}{U(k)}} + {{\overset{\_}{K}(k)}\left\lbrack {{Y(k)} - {{\overset{\_}{C}(k)}{\hat{\overset{\_}{X}}(k)}}} \right\rbrack}}};\quad (9)} \end{matrix}\quad$

the estimator gain {overscore (K)} satisfies $\begin{matrix} {{{\overset{\_}{K}(k)} = {{\overset{\_}{A}(k)}{\overset{\_}{Q}(k)}{{{\overset{\_}{C}}^{T}(k)}\left\lbrack {{{\overset{\_}{C}(k)}{\overset{\_}{Q}(k)}{{\overset{\_}{C}}^{T}(k)}} + {V_{2}(k)}} \right\rbrack}^{- 1}}};} & (10) \end{matrix}$

and the state estimation error covariance matrix {overscore (Q)} satisfies the recursive matrix Riccati equation. $\begin{matrix} {{\overset{\_}{Q}\left( {k + 1} \right)} = {{\left\lbrack {{\overset{\_}{A}(k)} - {{\overset{\_}{K}(k)}{\overset{\_}{C}(k)}}} \right\rbrack {\overset{\_}{Q}(k)}{{\overset{\_}{A}}^{T}(k)}} + {{{\overset{\_}{V}}_{1}(k)}.}}} & (11) \end{matrix}$

The final value of {overscore (P)} used to “initialize” Eq. (8) (which is solved backward in time) is the final value defined in the quadratic cost function of Eq. (5), that is, {overscore (P)}(k₁) = {overscore (P)}₁. The initial value of {overscore (Q)} used to initialize Eq. (11) is the error covariance of the initial estimate of X, that is, {overscore (Q)}(0) = {overscore (Q)}₀. If the system statistics defined in Eqs. (1) and (2) are gaussian, then the above solution is the optimal solution without qualification; if not, then it is the optimal linear control solution. The expected system performance is deter- mined by analyzing the augmented system as a linear, stochastic regulator problem. PRACTICAL APPLICATIONS From control gain Eqs. (7) and (8) and estimator gain Eqs. (10) and (11), it can be shown that the required dimensions of the controller and estimator are not, in general, equal. The dimensions of the control matrix Riccati equation (8) is determined by the number of delayed states in the process evolution, that is, {overscore (P)} has the dimensions of n · q × n = q. Consequently, for the special case of measurement delays only (q = 1), the controller implementation is unaffected. However, the dimensions or the estimator matrix Riccati equation (11) are determined by the maximum of p and q. Since h = max(p, q), then {overscore (Q)} has the dimensions n · h × n · h. For the general case, the optimal control is given by $\begin{matrix} {{{U(k)} = {- {\sum\limits_{i = 1}^{q}{{F_{1}(k)}{\hat{X}\left( {k + 1 - i} \right)}}}}},} & (12) \end{matrix}$

where $\begin{matrix} {{{\overset{\_}{F}(k)}\overset{\Delta}{=}\begin{bmatrix} {F_{q}(k)} & {F_{q - 1}(k)} & \cdots & {F_{2}(k)} & {F_{1}(k)} \end{bmatrix}},} & (13) \end{matrix}$

and $\begin{matrix} {{{\hat{\overset{\_}{X}}}^{T}(k)}\overset{\Delta}{=}{\begin{bmatrix} {{\hat{X}}^{T}\left( {k + 1 - h} \right)} & \cdots & {{\hat{X}}^{T}\left( {k + 1 - q} \right)} & \cdots & {{\hat{X}}^{T}\left( {k - 1} \right)} & {{\hat{X}}^{T}(k)} \end{bmatrix}.}} & (14) \end{matrix}$

We note that, in Eq. (14), {circumflex over (X)}(k) is the one-step predicted value of the original system state vector; {circumflex over (X)}(k − 1) is the filtered value; {circumflex over (X)}(k − 2) as the one-step smoothed value; and, finally, {circumflex over (X)}(k + 1 − h) is the (h − 2)th smoothed value. Typically, the real-time computational requirements associated with the implementation of time-varying optimal control are always stressing due to the “backward-in-time” recursion that is required to obtain solutions {overscore (P)} of Eq. (8). However, in many high-accuracy applications, the {overscore (A)}, {overscore (B)}, {overscore (R)}₁, and R₂ matrices of the augmented system and cost function can be treated as time invariant over the time intervals of interest. Further, if the augmented system satisfies the relatively minor requirements of stabilizability and detectability, then the control gain {overscore (F)} will converge to a unique value such that the steady- state optimal control law is time invariant, asymptotically stable, and mini- mizes the quadratic cost function of Eq. (5) as k₁ → ∞. For this case, the steady-state gain matrix {overscore (F)}_(ss) , can be computed off-line and stored for real- time use; the real-time computations required to implement this steady-state control law are negligible. Usually, for tracking and regulator problems, the steady-state control gains and time-varying gains are such that the initial value of the time-varying gain is equal to the steady-state gain but is less than or equal to the steady-state gain as time progresses, that is, {overscore (F)}_(ss) ≧ {overscore (F)}(k) for k₀ ≦ k ≦ k₁. As a consequence, the steady-state gain lends to maintain the controlled state closer to the estimated state, but at the cost of control energy. If accuracy is the significant criterion, then the steady-state gain is not only easy to implement but also provides essentially equivalent or better accuracy. This, however, is not the case for the estimator gain, even though in most cases where linear steady-state optimal stochastic control is implemented, both the steady-stare control and the estimator gains are used. For the es- timator, and the same general conditions as before, the initial time-varying estimator gain is usually significantly larger than the steady-state gain, to account for initial uncertainties in the knowledge of the system state. As time progresses, the time-varying gain converges to the steady-state gain, that is, {overscore (K)}_(ss) ≧ {overscore (K)}(k) for k₀ ≦ k ≦ k₁. Consequently, initial system performance is significantly degraded if K_(ss) is used. In fact, if applied to a “linearized” system, the estimator can actually diverge given the initial small steady-state filter gains. Hence a good compromise between performance and computational complexity is to choose the steady-state controller with the time-varying estimator. Further, because the estimator matrix Riccati equation is solved forward in time, the computations associated with the time-varying filter gain are orders of magnitude less than with the time-varying control gain and can usually be implemented in real time. Although the computations associated with the augmented system es- timator are significantly increased because of the increased dimensions, some simplifications can be made. The estimator Riccati equation can be separated into a time update and a measurement update, where the time update for the augmented system becomes primarily one of data transfer. If {overscore (Q)}, from Eq. (11), is defined as $\begin{matrix} {{{Q(k)} = \begin{bmatrix} {Q_{1,1}(k)} & {Q_{1,2}(k)} & \cdots & {Q_{1,h}(k)} \\ {Q_{2,1}(k)} & {Q_{2,2}(k)} & \cdots & \vdots \\ \vdots & \quad & \ddots & \quad \\ {Q_{k,1}(k)} & \cdots & \quad & {Q_{h,h}(k)} \end{bmatrix}},} & (15) \end{matrix}$

then, for the special case where q = 1 and p ≦ 2, the time update becomes $\begin{matrix} {\left. \begin{matrix} {{\left. \begin{matrix} {{Q_{i,j}\left( {k + 1} \right)} = {Q_{{i + 1},{j + 1}}(k)}} \\ {{Q_{i,P}\left( {k + 1} \right)} = {{Q_{{i + 1},P}(k)}{A_{1}^{T}(k)}}} \end{matrix} \right\} \quad i},{j = 1},\ldots \quad,{p - 1}} \\ {{Q_{p,p}\left( {k + 1} \right)} = {{{A_{1}(k)}{Q_{p,p}(k)}{A_{1}^{T}(k)}} + {V_{1}(k)}}} \end{matrix} \right\}.} & (16) \end{matrix}$

For the Worst case, where q > p > 1, the time update is given by $\begin{matrix} {\left. \begin{matrix} {{{Q_{i,j}\left( {k + 1} \right)} = {Q_{{i + 1},{j + 1}}(k)}},\quad i,{j = 1},\ldots \quad,{q - 1},} \\ {{{Q_{i,q}\left( {k + 1} \right)} = {\sum\limits_{j = 1}^{q}{{Q_{i,j}(k)}{A_{{({q + 1})} - j}^{T}(k)}}}},{i = 1},\ldots \quad,{q - 1},} \\ {{Q_{q,q}\left( {k + 1} \right)} = {{\sum\limits_{i = 1}^{q}{\sum\limits_{j = 1}^{q}{{A_{{({q + 1})} - i}(k)}{Q_{i,j}(k)}{A_{{({q + 1})} - j}^{T}(k)}}}} + {V_{1}(k)}}} \end{matrix} \right\}.} & (17) \end{matrix}$

In practice, another computational simplification results because rarely, if ever, is the actual system measurement a function of every time-delayed state element, and likewise for the actual system process model. Hence the submatrices A_(i) and C_(i) (for i > 1) in {overscore (A)} and {overscore (C)}, respectively, are usually of significantly reduced dimension. This, in turn, significantly reduces the dimensions of the augmented system model. We note that the iteration interval Δt (implied in the discrete-time system repre.seniazion) or some integer number of Δt's should be set equal to the time delay. For variable time delays, it may be advantageous to use (a) variable iteration intervals for the estimator, (b) fixed iteration intervals for the controller, and (c) variable-time updates of the State estimate to time synch the estimator output with the controller input Finally, for the analogous continuous-time problem, the filter equation becomes a partial differential equation with a boundary condition, and the covariance equation becomes a partial differential matrix equation with three boundary conditions (see [2]). Consequently, the most practical control solution is obtained by discretizing the continuous-time system representation and then applying the approach of Section III. One technique for discretizing the continuous-time representation is by using the Z transform method; see, for example, [5]. Using a scalar differential equation with one delayed state as an example, we have $\begin{matrix} {{\overset{.}{X}(t)} = {{\sum\limits_{i = 0}^{1}{a_{i}{X\left( {t - {i\quad {\Delta t}}} \right)}}} + {{U(t)}.}}} & (18) \end{matrix}$

If we assume that the output solution X(t) is sampled in discrete time, and if the system process can be reasonably approximated by a continuous system in which {dot over (X)} is driven by the output of a high-frequency sampling of the right side of Eq. (18), then the discrete-time process model is given by $\begin{matrix} {{X\left( {k + 1} \right)} = {{\left( {1 + {a_{0}{\Delta t}}} \right){X(k)}} + {\left( {a_{1}{\Delta t}} \right){X\left( {k - {\Delta t}} \right)}} + {({\Delta t}){{U(k)}.}}}} & (19) \end{matrix}$

The approximate discrete-time solution to Eq. (18), which is given by Eq. (19), is now in a form consistent with Eq. (1) of Section 11. and the ap- proach of Section III can be applied. 

What is claimed is:
 1. A method for providing a best estimate of glucose level in real time comprising the acts of: obtaining a measurement which is a function of glucose level, wherein noise associated with the measurement is within limits of a predefined measurement uncertainty; supplying the measurement to an extended Kalman filter in real time, wherein the extended Kalman filter has a dynamic process model, a dynamic measurement model, a state vector with at least one element corresponding to glucose level, and an error covariance matrix of the state vector; and determining the best estimate of glucose level in real time using the extended Kalman filter.
 2. The method of claim 1, wherein the extended Kalman filter is implemented using a software algorithm.
 3. The method of claim 1, wherein determination of the best estimate of glucose level in real time uses a recursive process comprising the acts of: computing a current estimate of the state vector using a preceding best estimate of the state vector and the dynamic process model; computing a current error covariance matrix of the state vector using a preceding error covariance matrix of the state vector, uncertainties associated with the dynamic process model, and the dynamic process model linearized about the current estimate of the state vector; computing a Kalman gain using the current covariance matrix, uncertainties associated with the dynamic measurement model, and the dynamic measurement model linearized about the current estimate of the state vector; computing a new error covariance matrix of the state vector using the current error covariance matrix of the state vector, the Kalman gain, and the dynamic measurement model linearized about the current estimate of the state vector; and computing a new best estimate of the state vector using the current estimate of the state vector, the Kalman gain, the measurement, and the dynamic measurement model.
 4. The method of claim 1, wherein development of the dynamic process model and the dynamic measurement model is an iterative process comprising the acts of: defining estimation variables and uncertain parameters which become elements of the state vector, defining nominal time propagation of the estimation variables and the uncertain parameters; defining a nominal sensor measurement model; defining relationships between the estimation variables, the uncertain parameters, and the measurement; defining uncertainties associated with the estimation variables, the uncertain parameters, and the measurement; and verifying a nominal dynamic process model and a nominal measurement model.
 5. The method of claim 4, wherein a database of measurements is used to empirically verify the nominal dynamic process model and the nominal measurement model.
 6. The method of claim 5, wherein the database has a plurality of sensor measurements with corresponding direct measurements.
 7. A realtime glucose estimator comprising: a plurality of measurement inputs, wherein at least one of the measurement inputs is configured to receive an input indicative of glucose level; a plurality of control inputs; and an extended Kalman filter algorithm configured to receive the plurality of measurement inputs and the plurality of control inputs to provide an optimal estimate of glucose level in real time.
 8. The real-time glucose estimator of claim 7, wherein at least two independent glucose sensors are coupled to the measurement inputs respectively.
 9. The real-time glucose estimator of claim 8, wherein at least two independent glucose sensors are of different types.
 10. The real-time glucose estimator of claim 7, wherein at least one of the measurement inputs is configured to receive a direct measurement of glucose.
 11. The real-time glucose estimator of claim 10, wherein the direct measurement is derived from a capillary blood glucose measurement.
 12. The real-time glucose estimator of claim 7, wherein at least one of the control inputs is configured to receive configuration data.
 13. The real-time glucose estimator of claim 7, wherein at least one of the control inputs is configured to receive environment data.
 14. The real-time glucose estimator of claim 7, wherein the extended Kalman filter algorithm produces the optimal estimate of glucose level in real time using a recursive loop formed by a time update module and a measurement update module.
 15. The real-time glucose estimator of claim 14, wherein the plurality of control inputs is processed in real time by the time update module.
 16. The real-time glucose estimator of claim 14, wherein the plurality of measurement inputs is processed in real time by the measurement update module.
 17. The real-time glucose estimator of claim 16, wherein measurement inputs of a substantially identical time interval are processed serially in one cycle of the measurement update module.
 18. The real-time glucose estimator of claim 10, wherein the direct measurement is provided during initialization of the real-time glucose estimator and intermittently thereafter.
 19. The realtime glucose estimator of claim 7, wherein at least one of the measurement inputs is provided periodically to the realtime glucose estimator.
 20. The real-time glucose estimator of claim 7, wherein at least one of the measurement inputs is coupled to a noninvasive glucose sensor.
 21. The real-time glucose estimator of claim 7 further comprising a patient health monitor configured to accept user inputs, to derive configuration data based on the user inputs, and to provide the configuration data in real time to the realtime glucose estimator.
 22. The realtime glucose estimator of claim 7 further comprising a patient health monitor configured to display in real time the optimal estimate of glucose level and to provide an audible alarm when the optimal estimate of glucose level is outside a predetermined range.
 23. The realtime glucose estimator of claim 10 further comprising a patient health monitor configured to display in real time a performance status for the real-time glucose estimator, wherein the performance status is based upon results of statistical testing performed on residuals of the extended Kalman filter.
 24. The real-time glucose estimator of claim 23, wherein the patient health monitor outputs a request for the direct measurement of glucose when the performance status indicates the optimal estimate of glucose level is outside predetermined limits.
 25. An estimator for monitoring a physiological parameter comprising: a sensor which outputs a measurement as a function of the physiological parameter; an electronic processor coupled to an output of the sensor, wherein the electronic processor executes an algorithm that implements an extended Kalman filter to estimate the physiological parameter in real time; and an interface coupled to an output of the electronic processor to display the estimate of the physiological parameter in real time.
 26. The estimator of claim 25, wherein the interface accepts user inputs and provides a control signal in real time to the electronic processor based on the user inputs.
 27. The estimator of claim 26, wherein the user inputs describe environmental conditions of the sensor in real time.
 28. The estimator of claim 26, wherein the user inputs describe activities of a patient using the estimator in real time.
 29. The estimator of claim 26, wherein the user inputs describe realtime administration of medication to a patient using the estimator.
 30. The estimator of claim 25, wherein the estimator is a portable device contained in a relatively small package and battery operated.
 31. An estimator comprising: means for obtaining a measurement related to a physiological parameter; and means for processing the measurement in real time using a linearized Kalman filter algorithm to provide a realtime estimate of the physiological parameter.
 32. The estimator of claim 31 further comprising means for displaying the realtime estimate of the physiological parameter in real time.
 33. The estimator of claim 31 further comprising means for updating the linearized Kalman filter algorithm in real time with user inputs.
 34. The estimator of claim 31 further comprising means for indicating performance status of the estimator in real time.
 35. A method for controlling glucose level in real time comprising the acts of: receiving an estimated glucose level; receiving a reference signal indicative of a desired glucose level; providing the estimated glucose level and the reference signal to a Kalman control algorithm in real time; determining a control command in real time using the Kalman control algorithm; and providing the control command to a dispenser which outputs medication in response to the control command.
 36. The method of claim 35, wherein the estimated glucose level is provided by an optimal estimator implemented using an extended Kalman filter.
 37. The method of claim 35, wherein the reference signal is provided by a patient health monitor which accepts inputs from a user.
 38. The method of claim 35, wherein the reference signal varies with time.
 39. The method of claim 35, wherein the Kalman control algorithm has a dynamic process model forced by the control command and a cost function determining a relative level of control.
 40. The method of claim 39, wherein determination of the control command in real time comprises the acts of: computing a Kalman control gain to minimize the cost function; and adjusting the control command based on the Kalman control gain and a difference between the estimated glucose level and the desired glucose level.
 41. The method of claim 35, wherein the dispenser secretes insulin or glucagon in response to the control command to correct a relatively high or a relatively low estimated glucose level.
 42. A method for close-loop control of a physiological parameter comprising the acts of: obtaining a measurement of the physiological parameter from a patient; providing the measurement to an optimal estimator in real time, wherein the optimal estimator outputs a best estimate of the physiological parameter in real time based on the measurements; providing the best estimate of the physiological parameter to an optimal controller in real time, wherein the optimal controller outputs a control command in real time based on the best estimate of the physiological parameter and a control reference; and providing the control command to an actuator, wherein the actuator provides an output to adjust the physiological parameter.
 43. The method of claim 42, wherein the measurement is obtained using a sensor.
 44. The method of claim 42, wherein the optimal estimator is implemented using a linearized Kalman algorithm.
 45. The method of claim 44, wherein the optimal controller is implemented using a Kalman control algorithm.
 46. The method of claim 45, wherein the optimal estimator and the optimal controller have substantially identical dynamic process models forced by the control command.
 47. The method of claim 46, wherein the optimal estimator provides a best estimate state vector to the optimal controller, and the best estimate of the physiological parameter is an element of the best estimate state vector.
 48. The method of claim 46, wherein the optimal controller provides the control command to the optimal estimator.
 49. The method of claim 42 wherein the optimal estimator and the optimal controller are implemented as a joint Kalman algorithm.
 50. The method of claim 42, wherein the control reference is provided by a patient health monitor.
 51. The method of claim 42, wherein the optimal estimator outputs best estimates of additional physiological parameters to the optimal controller in real time, and the optimal controller controls the additional physiological parameters by outputting additional control commands.
 52. A realtime optimal glucose controller comprising: a first input configured to receive an estimated glucose level in real time; a second input configured to receive a reference glucose level; a Kalman control algorithm configured to determine a control command based on the estimated glucose level and the reference glucose level, wherein the Kalman control algorithm has a dynamic process model forced by the control command and a cost function defining a desired level of control; and an output configured to provide the control command to a pump, wherein the pump provides medication in response to the control command to minimize a difference between the estimated glucose level and the reference glucose level.
 53. An artificial pancreas for controlling glucose level in real time comprising: a glucose sensor to provide a measurement of the glucose level; an optimal glucose estimator, wherein the optimal glucose estimator uses a stochastic model to describe a physiological process relating to the glucose level and uses a linearized Kalman filter to estimate the glucose level in real time based on the measurement from the glucose sensor; an optimal glucose controller, wherein the optimal glucose controller uses a substantially identical stochastic model as the optimal glucose estimator and uses a Kalman control algorithm to determine a control command to adjust the glucose level in real time; and a medical dispenser to provide medication to a patient in response to the control command.
 54. The artificial pancreas of claim 53, wherein the optimal glucose estimator and the optimal glucose controller are implemented using a software algorithm.
 55. The artificial pancreas of claim 53, wherein the artificial pancreas is a portable device.
 56. The artificial pancreas of claim 53 further comprising one or more additional sensors of different types which operate independently to provide respective glucose measurements.
 57. The artificial pancreas of claim 53, wherein the medical dispenser secretes insulin and glucagon to control a relatively high glucose level and a relatively low glucose level respectively.
 58. The artificial pancreas of claim 53 further comprising a patient health monitor with an input/output interface to receive inputs from a user and to display status of the artificial pancreas. 